package com.aspose.cells;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

class zbcs extends CollectionBase implements zahw {
   private zig d;
   private zfr e;
   private zfr f;
   private ArrayList g;
   private ArrayList h;
   boolean b = false;
   boolean c = false;
   private ArrayList[] i;
   private ArrayList j = new ArrayList();
   private ArrayList[] k;

   zbcs(zig var1) {
      this.d = var1;
      this.e = new zfr((zfp)null);
      this.f = new zfr((zfp)null);
      this.g = new ArrayList();
      this.h = new ArrayList();
   }

   public zafs a() {
      return this.e;
   }

   public zafs b() {
      return this.f;
   }

   ArrayList c() {
      return this.g;
   }

   void a(ArrayList var1) {
      this.g = var1;
   }

   ArrayList d() {
      return this.h;
   }

   void b(ArrayList var1) {
      this.h = var1;
   }

   ArrayList[] e() {
      return this.i;
   }

   void a(ArrayList[] var1) {
      this.i = var1;
   }

   ArrayList f() {
      return this.j;
   }

   ArrayList[] g() {
      return this.k;
   }

   void b(ArrayList[] var1) {
      this.k = var1;
   }

   public zahv a(int var1) {
      return (zahv)this.a.get(var1);
   }

   zbcq c(int var1) {
      return (zbcq)this.a.get(var1);
   }

   public zahv b(int var1) {
      zbcq var2 = new zbcq(this.d, this, var1);
      var2.l(this.getCount());
      var2.b(this.getCount());
      var2.a(this.getCount());
      com.aspose.cells.b.a.a.ze.a(this.a, (Object)var2);
      return var2;
   }

   void a(zbcq var1) {
      com.aspose.cells.b.a.a.ze.a(this.a, (Object)var1);
   }

   int h() {
      ArrayList var1 = new ArrayList();

      for(int var2 = 0; var2 < this.getCount(); ++var2) {
         com.aspose.cells.b.a.a.ze.a(var1, (Object)this.a(var2).k().getCount());
      }

      Collections.sort(var1);
      return (Integer)var1.get(var1.size() - 1);
   }

   zbcq d(int var1) {
      Iterator var2 = this.iterator();

      zbcq var3;
      do {
         if (!var2.hasNext()) {
            return null;
         }

         var3 = (zbcq)var2.next();
      } while(!var3.am() || var3.ag() != var1);

      return var3;
   }

   int e(int var1) {
      int var2 = 0;
      Iterator var3 = this.iterator();

      while(var3.hasNext()) {
         zbcq var4 = (zbcq)var3.next();
         if (var4.am() && var1 == var4.ag()) {
            ++var2;
         }
      }

      return var2;
   }

   zbcq a(int var1, int var2) {
      Iterator var3 = this.iterator();

      zbcq var4;
      do {
         if (!var3.hasNext()) {
            return null;
         }

         var4 = (zbcq)var3.next();
      } while(var4.m() != var2 || var1 != var4.ag());

      return var4;
   }

   int b(int var1, int var2) {
      int var3 = 0;
      Iterator var4 = this.iterator();

      while(var4.hasNext()) {
         zbcq var5 = (zbcq)var4.next();
         if (var5.m() == var2 && var1 == var5.ag()) {
            ++var3;
         }
      }

      return var3;
   }

   List i() {
      return this.a;
   }

   ArrayList j() {
      ArrayList var1 = new ArrayList();
      com.aspose.cells.b.a.a.ze.a(var1, (Collection)this.a);
      zbcu var2 = new zbcu();
      Collections.sort(var1, var2);
      return var1;
   }

   ArrayList k() {
      ArrayList var1 = this.j();
      return this.c(var1);
   }

   private ArrayList c(ArrayList var1) {
      ArrayList var2 = new ArrayList();
      if (var1.size() > 0) {
         com.aspose.cells.b.a.a.ze.a(var2, var1.get(0));
      }

      for(int var3 = 1; var3 < var1.size(); ++var3) {
         zbcq var4 = (zbcq)var1.get(var3);
         boolean var5 = false;

         for(int var6 = 0; var6 < var2.size(); ++var6) {
            zbcq var7 = (zbcq)var2.get(var6);
            if (var4.aC() < var7.aC()) {
               var2.add(var6, var4);
               var5 = true;
               break;
            }
         }

         if (!var5) {
            com.aspose.cells.b.a.a.ze.a(var2, (Object)var4);
         }
      }

      return var2;
   }

   List a(int var1, int[] var2) {
      ArrayList var3 = this.j();
      ArrayList var4 = new ArrayList();
      Iterator var5 = var3.iterator();

      while(var5.hasNext()) {
         zbcq var6 = (zbcq)var5.next();
         if (var6.a(var2) && var6.ag() == var1) {
            com.aspose.cells.b.a.a.ze.a(var4, (Object)var6);
         }
      }

      return var4;
   }

   zbcq a(int var1, int var2, int[] var3) {
      List var4 = this.a(var2, var3);
      return var4.size() > var1 ? (zbcq)var4.get(var1) : null;
   }

   int a(zbcq var1, int var2, int[] var3) {
      ArrayList var4 = new ArrayList();
      Iterator var5 = this.iterator();

      while(true) {
         while(var5.hasNext()) {
            zbcq var6 = (zbcq)var5.next();
            int[] var7 = var3;
            int var8 = var3.length;

            for(int var9 = 0; var9 < var8; ++var9) {
               int var10 = var7[var9];
               if (var6.m() == var10 && var6.ag() == var2) {
                  com.aspose.cells.b.a.a.ze.a(var4, (Object)var6);
                  break;
               }
            }
         }

         if (var4.size() > 0) {
            zbcu var11 = new zbcu();
            Collections.sort(var4, var11);

            for(int var12 = 0; var12 < var4.size(); ++var12) {
               zbcq var13 = (zbcq)var4.get(var12);
               if (var1.equals(var13)) {
                  return var12;
               }
            }
         }

         return -1;
      }
   }

   ArrayList l() {
      ArrayList var1 = new ArrayList();

      for(int var2 = 0; var2 < this.a.size(); ++var2) {
         zbcq var3 = this.c(var2);
         if (!var3.j()) {
            for(int var4 = 0; var4 < var3.G().getCount(); ++var4) {
               com.aspose.cells.b.a.a.ze.a(var1, (Object)var3.G().a(var4));
            }
         }
      }

      return var1;
   }

   ArrayList m() {
      ArrayList var1 = new ArrayList();

      for(int var2 = 0; var2 < this.a.size(); ++var2) {
         zbcq var3 = this.c(var2);
         if (var3.j()) {
            for(int var4 = 0; var4 < var3.G().getCount(); ++var4) {
               com.aspose.cells.b.a.a.ze.a(var1, (Object)var3.G().a(var4));
            }
         }
      }

      return var1;
   }

   int n() {
      int var1 = this.a.size();
      Iterator var2 = this.a.iterator();

      while(var2.hasNext()) {
         zbcq var3 = (zbcq)var2.next();
         if (var3.a() + 1 > var1) {
            var1 = var3.a() + 1;
         }
      }

      return var1;
   }

   // $FF: synthetic method
   public Object get(int x0) {
      return this.a(x0);
   }
}
